/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package TCP;

import Communication.Communica;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.net.*;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Arthur
 */
public class TCPServer {
    
    static int port = 4000;
    
   public static void main(String[] args){
        try {
            ServerSocket socketServeur = new ServerSocket (port);
            System.out.println("Lancement serveur");
            while(true){
            Socket clientSocket = socketServeur.accept();
            System.out.println("Connexion avec : "+clientSocket.getInetAddress());
            BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
            BufferedWriter out = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));  
            Communica A = new Communica(out,new ListenSocket(in));
            }
        } catch (IOException ex) {
            Logger.getLogger(TCPServer.class.getName()).log(Level.SEVERE, null, ex);
        }

        
       
   }
    
    

}
